package com.demo.io;

import java.io.*;
import java.util.zip.GZIPOutputStream;

public class UploadFileDemo {
    public static void main(String[] args) throws IOException {
        File file = new File("E:\\xxx\\001.xlsx");

        InputStream inputStream = new FileInputStream(file);
        OutputStream outputStream = new FileOutputStream("E:\\xxx");
        int len = 0;
        byte[] bytes = new byte[8192];
        while ( ( len = inputStream.read(bytes) ) != -1 ) {
            outputStream.write(bytes, 0, len);
        }
        GZIPOutputStream gzipOutputStream = new GZIPOutputStream(outputStream);
        gzipOutputStream.flush();
        gzipOutputStream.close();
        inputStream.close();

    }
}
